﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KeyboardBubble.Common
{
    /// <summary>
    /// 键盘键位表
    /// </summary>
    public class KeyboardKeys
    {
        private static Dictionary<int, string> keyDict { get; set; }
        /// <summary>
        /// 获取单例
        /// </summary>
        public static Dictionary<int, string> Instace
        {
            get
            {
                if (keyDict == null)
                {
                    keyDict = new Dictionary<int, string>();
                    foreach (Keys key in Enum.GetValues(typeof(Keys)))
                    {
                        keyDict[(int)key] = key.ToString();
                    }
                    keyDict[27] = "Esc";
                    keyDict[112] = "F1";
                    keyDict[113] = "F2";
                    keyDict[114] = "F3";
                    keyDict[115] = "F4";
                    keyDict[116] = "F5";
                    keyDict[117] = "F6";
                    keyDict[118] = "F7";
                    keyDict[119] = "F8";
                    keyDict[120] = "F9";
                    keyDict[121] = "F10";
                    keyDict[122] = "F11";
                    keyDict[123] = "F12";
                    keyDict[44] = "Prt";
                    keyDict[145] = "Scr";
                    keyDict[19] = "Pau";

                    keyDict[192] = "~";
                    keyDict[49] = "1";
                    keyDict[50] = "2";
                    keyDict[51] = "3";
                    keyDict[52] = "4";
                    keyDict[53] = "5";
                    keyDict[54] = "6";
                    keyDict[55] = "7";
                    keyDict[56] = "8";
                    keyDict[57] = "9";
                    keyDict[48] = "0";
                    keyDict[189] = "-";
                    keyDict[187] = "=";
                    keyDict[45] = "Insert";
                    keyDict[36] = "Home";
                    keyDict[33] = "Pageup";
                    keyDict[144] = "Numlock";
                    keyDict[111] = "Num\\";
                    keyDict[106] = "Num*";
                    keyDict[109] = "Num-";

                    keyDict[9] = "Tab";
                    keyDict[219] = "[";
                    keyDict[221] = "]";
                    keyDict[13] = "Enter";
                    keyDict[46] = "Delete";
                    keyDict[35] = "End";
                    keyDict[34] = "Pagedown";
                    keyDict[103] = "Num7";
                    keyDict[104] = "Num8";
                    keyDict[105] = "Num9";
                    keyDict[107] = "Num+";

                    keyDict[20] = "Cpaslock";
                    keyDict[186] = ";";
                    keyDict[222] = "'";
                    keyDict[100] = "Num4";
                    keyDict[101] = "Num6";
                    keyDict[102] = "Num6";

                    keyDict[16] = "Shift";
                    keyDict[188] = ",";
                    keyDict[190] = ".";
                    keyDict[191] = "/";
                    keyDict[38] = "Up";
                    keyDict[97] = "Num1";
                    keyDict[98] = "Num2";
                    keyDict[99] = "Num3";

                    keyDict[17] = "Ctrl";
                    keyDict[91] = "Win";
                    keyDict[18] = "Alt";
                    keyDict[32] = "Space";
                    keyDict[92] = "Win";
                    keyDict[37] = "Left";
                    keyDict[40] = "Down";
                    keyDict[39] = "Right";
                    keyDict[96] = "Num0";
                    keyDict[110] = "Num.";
                }
                return keyDict;
            }
        }
    }
}